jq(function(){
	newsMorePage();
	function newsMorePage(){
		jq.getJSON("RightNewsServlet?opr=more",getNews);
		function getNews(data){
			var $newsMoreTable=jq(".m_right table").empty().append("<tr><td align=\"center\" width=\"380px\">文章标题</td><td align=\"center\" width=\"380px\">创建时间</td></tr>");
			var news=data.newsList;
			for(var i=0;i<news.length;i++){
				$newsMoreTable.append("<tr><td align='center'><a href='javascript:;' id='"+news[i].id+"' class=\"xxxxxxx\">"+news[i].title+"</a></td><td align='center'>"+news[i].createTime+"</td></tr>");
			}
		}
		jq("#first").click(function(){
			jq.getJSON("RightNewsServlet?opr=more&currNo=1",getNews);
			jq(this).parent().css({"background-color":"orange"}).siblings().css({"background-color":"white"});
		});
		jq("#one").click(function(){
			jq.getJSON("RightNewsServlet?opr=more&currNo=1",getNews);
			jq(this).parent().css({"background-color":"orange"}).siblings().css({"background-color":"white"});
		});
		jq("#two").click(function(){
			jq.getJSON("RightNewsServlet?opr=more&currNo=2",getNews);
			jq(this).parent().css({"background-color":"orange"}).siblings().css({"background-color":"white"});
		});
		jq("#three").click(function(){
			jq.getJSON("RightNewsServlet?opr=more&currNo=3",getNews);
			jq(this).parent().css({"background-color":"orange"}).siblings().css({"background-color":"white"});
		});
		jq("#four").click(function(){
			jq.getJSON("RightNewsServlet?opr=more&currNo=4",getNews);
			jq(this).parent().css({"background-color":"orange"}).siblings().css({"background-color":"white"});
		});
		jq("#last").click(function(){
			jq.getJSON("RightNewsServlet?opr=more&currNo=4",getNews);
			jq(this).parent().css({"background-color":"orange"}).siblings().css({"background-color":"white"});
		});
		//点击标题，查看资讯内容
		jq(".m_right").on("click",".xxxxxxx",function(){
			var id=this.id;
			jq.getJSON("NewsInfoServlet","id="+id,function(data){
				var $newsDiv=jq(".m_right").empty().append("<a href='newsMore.html'>返回新闻列表首页</a>");
				$newsDiv.append("<h1>"+data[0].title+"</h1>").append("<p>"+data[0].content+"</p>");
				
			});
			
		});
		
	}
	
	
});